package com.experiment07;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import com.experiment07.Railway;
public class SellStation {
    private String name;
    private Random random = new Random();

    public SellStation(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Ticket> tickets = new ArrayList<>();

    public List<Ticket> getTickets() {
        return tickets;
    }

    public Ticket sellTickets() {
        Ticket ticket = Railway.provideTicket();
        if(ticket != null){
            tickets.add(ticket);
        }
        try{
            Thread.sleep(random.nextInt(50));
        }catch (InterruptedException e){
            System.out.println(e.getMessage());
        }
        return ticket;
    }

}
